fun main() {
    val v1 = Vehicle("car", 8)
    v1.intro()
}

// 主构造函数和次构造函数示例：获取车辆轮子个数
class Vehicle(val type: String) {
    var wheels: Int = 0

    init {
        wheels = when (type) {
            "car" -> 4
            "bike" -> 2
            "truck" -> 6
            "motorcycle" -> 2
            "bus" -> 8
            "train" -> 10
            "airplane" -> 12
            "ship" -> 10
            "helicopter" -> 6
            "drone" -> 4
            else -> 0
        }
    }

    constructor(type: String, wheels: Int) : this(type) {
        this.wheels = wheels
    }

    fun intro() {
        println("我是一辆: $type, 我有: ${wheels}个轮子")
    }
}



